<?php

// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;
use Think\Model;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class PluginsController extends HomeController{
    public function adjunct(){
        if (empty($id)) {
        } else {
            $User = M("pictuer");
            $User->where("id=" . $id . "")->delete();   //删除所选数据.
        }
        $idd=I("get.p",1);
        $a=($idd-1)*10;
        $b=10;
        $User=M("picture");
        $list=$User->where()->order("id desc")->limit($a,$b)->select();
        $row=count($User->where()->select());
        $this->assign("row",$row);
        $Page=new \Think\Page($row,10);
        $show=$Page->show();
        $this->assign("list",$list);
        $this->assign("page",$show);
        $this->display();
    }
    public function adjunct_newly(){
        $get=I("post.cover");

        if($get){
            echo "New information submitted to success , You can also continue to add";
            $this->display();
        }else {
            $this->display();
        }
    }
    public function adjunct_edit(){
        $post=I("post.");
        $id=I("get.id");
        $User=M("picture");
        if($post){
            $User->where("id=".$id."")->save($post);
            $arr=$User->where("id=".$id."")->select();
            $this->assign("arr",$arr);
            echo "Modify the information successfully";
        }
        else {
            $arr=$User->where("id=".$id."")->select();
            $this->assign("arr",$arr);
        }
        $this->display();
    }
    public function index(){

        $this->display();
    }
}